package com.pjmike.netty.server.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component("messageContext")
@Slf4j
public class MessageContext {
    @Autowired
    private List<MessageService> messageServiceList;

    public String doDispatcher(String message){
        if(messageServiceList!=null){
            for(MessageService s:messageServiceList){
                String ret = s.messageDispatcher(message);
                if(ret!=null){
                    return ret;
                }
            }
        }
        return null;
    }
}
